import type { UnwrapNestedRefs } from 'vue'

interface ConsultTableModel {
  list: Array<any>
  total: number
}

export interface FormState {
  roleMenuId: number
  menuIds: number[]
  roleId: number
}

type ConsultTableParams = Partial<Omit<ConsultTableModel, 'menuId'>>

export function getUserRoleListApi(roleId: number) {
  return useGet('/sRoleMenu/roleMenus', { 'roleId': roleId })
}

export async function batchUpdateApi(formState: UnwrapNestedRefs<FormState> & {}, config?: AxiosRequestConfig & RequestConfigExtra) {
  return usePost(`/sRoleMenu/batchUpdate`, formState, config)
}

export type{
  ConsultTableParams,
  ConsultTableModel,
}
